/*
 * main.cpp
 *
 *  Created on: 27/09/2013
 *      Author: asc
 */

#if HAVE_CONFIG_H
#include <config.h>
#endif

#ifndef DATADIR
#define DATADIR "/usr/share/tailorng"
#endif

#include <iostream>
#include <cstdio>
#include "RepoTemplate/RepoTemplate.h"
#include "libsvn/Libsvn.h"
#include "libbzr/Libbzr.h"
#include "libgit/Libgit.h"
#include "libcvs/Libcvs.h"

using namespace std;

	enum keys_vcs{cvs=1, svn, git, bzr};
	map<string,keys_vcs> resolv_key_vcs =
	{
			{"cvs"	,cvs},
			{"svn"	,svn},
			{"git"	,git},
			{"bzr"	,bzr}
	};

int main(int argc, char* argv[])
{
	string pkgdatadir(DATADIR);
	RepoTemplate* x=NULL;
	if(argc == 2)
	{
		switch(resolv_key_vcs[argv[1]])
		{
			case cvs:
			{
				cout << "cvs parse log" << endl;
				x = new Libcvs::Libcvs(pkgdatadir + "/cvsCommandList.cfg");
				break;
			}
			case svn:
			{
				cout << "svn parse log" << endl;
				x = new Libsvn::Libsvn(pkgdatadir + "/svnCommandList.cfg");
				break;
			}
			case git:
			{
				cout << "git parse log" << endl;
				x = new Libgit::Libgit(pkgdatadir + "/gitCommandList.cfg");
				break;
			}
			case bzr:
			{
				cout << "bzr parse log" << endl;
				x = new Libbzr::Libbzr(pkgdatadir + "/bzrCommandList.cfg");
				break;
			}
			default:
				cout << "hola mundo:" << DATADIR <<endl;
		}

		if(x != NULL)
		{
			x->read();
			delete x;
			x=NULL;
		}
	}
	else
	{
		cout << "hola mundo:" << DATADIR <<endl;
	}

	cout << "WHY????" << endl;
	exit(0);
	return(0);
}



